package com.lyeducation.util;

import java.util.Random;

/**
 * @ClassName KeyUtil
 * @Description
 * @Author Sky1in3
 * @Date 2019/1/12 23:21
 * @Version 1.0
 */
public class KeyUtil {
    /**
     * @Author Sky1in3
     * @Description 生成唯一的主键,格式: 时间+随机数
     * @Date 2019/1/12 23:21
     * @Param []
     * @return java.lang.String
     */
    public static synchronized String genUniqueKey() {
        Random random = new Random();
//        Integer number = random.nextInt(900000) + 100000;
        Integer number = random.nextInt(9000) + 1000;

        return System.currentTimeMillis() + String.valueOf(number);
    }
}
